import request from '@/utils/request';
import { AxiosPromise } from 'axios';

export interface UserApiRecordVO extends BaseDomain {
    id: string | number;
    userId: string;
    url: string;
    ip: string;
    port: string;
    sessionId: string;
}

export interface UserApiRecordQuery extends PageQuery {
}

export interface UserApiRecordForm {
    id: number | string | undefined;
    userId: string;
    url: string;
    ip: string;
    port: string;
    sessionId: string;
}

// 查询
export function apiPageListUserApiRecord(query: UserApiRecordQuery): AxiosPromise<UserApiRecordVO[]> {
    return request({
        url: '/user/userApiRecord/list',
        method: 'get',
        params: query
    });
}

// 查询
export function apiGetUserApiRecordDetail(id: string | number): AxiosPromise<UserApiRecordVO> {
    return request({
        url: '/user/userApiRecord/info',
        method: 'get',
        params: { id }
    });
}

// 新增
export function apiAddUserApiRecord(data: UserApiRecordForm) {
    return request({
        url: '/user/userApiRecord/add',
        method: 'post',
        data: data
    });
}

// 修改
export function apiUpdateUserApiRecord(data: UserApiRecordForm) {
    return request({
        url: '/user/userApiRecord/update',
        method: 'post',
        data: data
    });
}

// 删除
export function apiRemoveUserApiRecord(ids: Array<string | number>) {
    return request({
        url: '/user/userApiRecord/remove',
        method: 'post',
        data: { ids }
    });
}
